package com.zlm.common.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 工作性质枚举类
 * @author zp
 * @date 2015-1-28-下午5:11:37
 * @version 1.0.0
 * @Copyright © 2015 www.longsoftware.com
 */
public enum JobNatureEnum {
   NATURE_FULL_TIME(0,"全职"),
   NATURE_PART_TIME(1,"兼职"),
   NATURE_PRACTICE(2,"实习");

	private Integer code;
	private String name;
	
	private JobNatureEnum(Integer code, String name){
		this.code=code;
		this.name=name;
	}

    @SuppressWarnings({ "rawtypes", "unchecked" })
	public static List getJobNature(){
    	List list = new ArrayList();
    	Map<String,Object> map;
    	for(JobNatureEnum jobNatureEnum:JobNatureEnum.values()){
    		map= new HashMap<String, Object>();
    		map.put("code", jobNatureEnum.getCode());
    		map.put("name", jobNatureEnum.getName());
    		list.add(map);
    	}
    	return list;
    } 
    
    /**
     * 根据code得到name
     * @param code
     * @return
     */
    public static String getNameByCode(Integer code){
    	for(JobNatureEnum jobNatureEnum:JobNatureEnum.values()){
    		if(code.equals(jobNatureEnum.getCode())){
    			return jobNatureEnum.getName();
    		}
    	}
    	return null;
    	
    }

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
}
